3.61 \(\int \frac {\tan ^2(c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^4} \, dx\)

Optimal. Leaf size=145 \[ -\frac {B+i A}{16 a^4 d (1+i \tan (c+d x))}+\frac {5 B+i A}{16 a^4 d (1+i \tan (c+d x))^2}-\frac {x (A-i B)}{16 a^4}+\frac {(-B+i A) \tan ^2(c+d x)}{8 d (a+i a \tan (c+d x))^4}-\frac {B}{6 a d (a+i a \tan (c+d x))^3} \]

[Out]

-1/16*(A-I*B)*x/a^4+1/16*(I*A+5*B)/a^4/d/(1+I*tan(d*x+c))^2+1/16*(-I*A-B)/a^4/d/(1+I*tan(d*x+c))+1/8*(I*A-B)*t
an(d*x+c)^2/d/(a+I*a*tan(d*x+c))^4-1/6*B/a/d/(a+I*a*tan(d*x+c))^3

________________________________________________________________________________________

Rubi [A]  time = 0.29, antiderivative size = 145, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 34, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.147, Rules used = {3595, 3590, 3526, 3479, 8} \[ -\frac {B+i A}{16 a^4 d (1+i \tan (c+d x))}+\frac {5 B+i A}{16 a^4 d (1+i \tan (c+d x))^2}-\frac {x (A-i B)}{16 a^4}+\frac {(-B+i A) \tan ^2(c+d x)}{8 d (a+i a \tan (c+d x))^4}-\frac {B}{6 a d (a+i a \tan (c+d x))^3} \]

Antiderivative was successfully verified.

[In]

Int[(Tan[c + d*x]^2*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x])^4,x]

[Out]

-((A - I*B)*x)/(16*a^4) + (I*A + 5*B)/(16*a^4*d*(1 + I*Tan[c + d*x])^2) - (I*A + B)/(16*a^4*d*(1 + I*Tan[c + d
*x])) + ((I*A - B)*Tan[c + d*x]^2)/(8*d*(a + I*a*Tan[c + d*x])^4) - B/(6*a*d*(a + I*a*Tan[c + d*x])^3)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3479

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(a*(a + b*Tan[c + d*x])^n)/(2*b*d*n), x] +
Dist[1/(2*a), Int[(a + b*Tan[c + d*x])^(n + 1), x], x] /; FreeQ[{a, b, c, d}, x] && EqQ[a^2 + b^2, 0] && LtQ[n
, 0]

Rule 3526

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> -Simp[((
b*c - a*d)*(a + b*Tan[e + f*x])^m)/(2*a*f*m), x] + Dist[(b*c + a*d)/(2*a*b), Int[(a + b*Tan[e + f*x])^(m + 1),
 x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && LtQ[m, 0]

Rule 3590

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_
.) + (f_.)*(x_)]), x_Symbol] :> -Simp[((A*b - a*B)*(a*c + b*d)*(a + b*Tan[e + f*x])^m)/(2*a^2*f*m), x] + Dist[
1/(2*a*b), Int[(a + b*Tan[e + f*x])^(m + 1)*Simp[A*b*c + a*B*c + a*A*d + b*B*d + 2*a*B*d*Tan[e + f*x], x], x],
 x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a*d, 0] && LtQ[m, -1] && EqQ[a^2 + b^2, 0]

Rule 3595

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_), x_Symbol] :> -Simp[((A*b - a*B)*(a + b*Tan[e + f*x])^m*(c + d*Tan[e + f*x])^n)/(2*a*f*
m), x] + Dist[1/(2*a^2*m), Int[(a + b*Tan[e + f*x])^(m + 1)*(c + d*Tan[e + f*x])^(n - 1)*Simp[A*(a*c*m + b*d*n
) - B*(b*c*m + a*d*n) - d*(b*B*(m - n) - a*A*(m + n))*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A,
B}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && LtQ[m, 0] && GtQ[n, 0]

Rubi steps

\begin {align*} \int \frac {\tan ^2(c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^4} \, dx &=\frac {(i A-B) \tan ^2(c+d x)}{8 d (a+i a \tan (c+d x))^4}-\frac {\int \frac {\tan (c+d x) (2 a (i A-B)-2 a (A-3 i B) \tan (c+d x))}{(a+i a \tan (c+d x))^3} \, dx}{8 a^2}\\ &=\frac {(i A-B) \tan ^2(c+d x)}{8 d (a+i a \tan (c+d x))^4}-\frac {B}{6 a d (a+i a \tan (c+d x))^3}+\frac {i \int \frac {-8 a^2 B-4 a^2 (A-3 i B) \tan (c+d x)}{(a+i a \tan (c+d x))^2} \, dx}{16 a^4}\\ &=\frac {i A+5 B}{16 a^4 d (1+i \tan (c+d x))^2}+\frac {(i A-B) \tan ^2(c+d x)}{8 d (a+i a \tan (c+d x))^4}-\frac {B}{6 a d (a+i a \tan (c+d x))^3}-\frac {(A-i B) \int \frac {1}{a+i a \tan (c+d x)} \, dx}{8 a^3}\\ &=\frac {i A+5 B}{16 a^4 d (1+i \tan (c+d x))^2}+\frac {(i A-B) \tan ^2(c+d x)}{8 d (a+i a \tan (c+d x))^4}-\frac {B}{6 a d (a+i a \tan (c+d x))^3}-\frac {i A+B}{16 d \left (a^4+i a^4 \tan (c+d x)\right )}-\frac {(A-i B) \int 1 \, dx}{16 a^4}\\ &=-\frac {(A-i B) x}{16 a^4}+\frac {i A+5 B}{16 a^4 d (1+i \tan (c+d x))^2}+\frac {(i A-B) \tan ^2(c+d x)}{8 d (a+i a \tan (c+d x))^4}-\frac {B}{6 a d (a+i a \tan (c+d x))^3}-\frac {i A+B}{16 d \left (a^4+i a^4 \tan (c+d x)\right )}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 1.68, size = 144, normalized size = 0.99 \[ -\frac {(\cos (4 (c+d x))-i \sin (4 (c+d x))) (3 (8 A d x+i A-8 i B d x-B) \cos (4 (c+d x))+24 i A d x \sin (4 (c+d x))+3 A \sin (4 (c+d x))-12 i A-32 i B \sin (2 (c+d x))+3 i B \sin (4 (c+d x))+24 B d x \sin (4 (c+d x))-16 B \cos (2 (c+d x)))}{384 a^4 d} \]

Antiderivative was successfully verified.

[In]

Integrate[(Tan[c + d*x]^2*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x])^4,x]

[Out]

-1/384*((Cos[4*(c + d*x)] - I*Sin[4*(c + d*x)])*((-12*I)*A - 16*B*Cos[2*(c + d*x)] + 3*(I*A - B + 8*A*d*x - (8
*I)*B*d*x)*Cos[4*(c + d*x)] - (32*I)*B*Sin[2*(c + d*x)] + 3*A*Sin[4*(c + d*x)] + (3*I)*B*Sin[4*(c + d*x)] + (2
4*I)*A*d*x*Sin[4*(c + d*x)] + 24*B*d*x*Sin[4*(c + d*x)]))/(a^4*d)

________________________________________________________________________________________

fricas [A]  time = 0.50, size = 78, normalized size = 0.54 \[ -\frac {{\left (24 \, {\left (A - i \, B\right )} d x e^{\left (8 i \, d x + 8 i \, c\right )} - 24 \, B e^{\left (6 i \, d x + 6 i \, c\right )} - 12 i \, A e^{\left (4 i \, d x + 4 i \, c\right )} + 8 \, B e^{\left (2 i \, d x + 2 i \, c\right )} + 3 i \, A - 3 \, B\right )} e^{\left (-8 i \, d x - 8 i \, c\right )}}{384 \, a^{4} d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^2*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^4,x, algorithm="fricas")

[Out]

-1/384*(24*(A - I*B)*d*x*e^(8*I*d*x + 8*I*c) - 24*B*e^(6*I*d*x + 6*I*c) - 12*I*A*e^(4*I*d*x + 4*I*c) + 8*B*e^(
2*I*d*x + 2*I*c) + 3*I*A - 3*B)*e^(-8*I*d*x - 8*I*c)/(a^4*d)

________________________________________________________________________________________

giac [A]  time = 1.29, size = 151, normalized size = 1.04 \[ -\frac {\frac {12 \, {\left (i \, A + B\right )} \log \left (\tan \left (d x + c\right ) + i\right )}{a^{4}} + \frac {12 \, {\left (-i \, A - B\right )} \log \left (\tan \left (d x + c\right ) - i\right )}{a^{4}} + \frac {25 i \, A \tan \left (d x + c\right )^{4} + 25 \, B \tan \left (d x + c\right )^{4} + 124 \, A \tan \left (d x + c\right )^{3} - 124 i \, B \tan \left (d x + c\right )^{3} - 246 i \, A \tan \left (d x + c\right )^{2} - 54 \, B \tan \left (d x + c\right )^{2} - 124 \, A \tan \left (d x + c\right ) - 4 i \, B \tan \left (d x + c\right ) + 25 i \, A - 7 \, B}{a^{4} {\left (\tan \left (d x + c\right ) - i\right )}^{4}}}{384 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^2*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^4,x, algorithm="giac")

[Out]

-1/384*(12*(I*A + B)*log(tan(d*x + c) + I)/a^4 + 12*(-I*A - B)*log(tan(d*x + c) - I)/a^4 + (25*I*A*tan(d*x + c
)^4 + 25*B*tan(d*x + c)^4 + 124*A*tan(d*x + c)^3 - 124*I*B*tan(d*x + c)^3 - 246*I*A*tan(d*x + c)^2 - 54*B*tan(
d*x + c)^2 - 124*A*tan(d*x + c) - 4*I*B*tan(d*x + c) + 25*I*A - 7*B)/(a^4*(tan(d*x + c) - I)^4))/d

________________________________________________________________________________________

maple [A]  time = 0.23, size = 244, normalized size = 1.68 \[ -\frac {B \ln \left (\tan \left (d x +c \right )+i\right )}{32 d \,a^{4}}-\frac {i A \ln \left (\tan \left (d x +c \right )+i\right )}{32 d \,a^{4}}+\frac {i A}{16 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )^{2}}-\frac {7 B}{16 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )^{2}}-\frac {i A}{8 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )^{4}}+\frac {B}{8 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )^{4}}-\frac {A}{16 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )}+\frac {i B}{16 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )}+\frac {i \ln \left (\tan \left (d x +c \right )-i\right ) A}{32 d \,a^{4}}+\frac {\ln \left (\tan \left (d x +c \right )-i\right ) B}{32 d \,a^{4}}-\frac {A}{4 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )^{3}}-\frac {5 i B}{12 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )^{3}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(d*x+c)^2*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^4,x)

[Out]

-1/32/d/a^4*B*ln(tan(d*x+c)+I)-1/32*I/d/a^4*A*ln(tan(d*x+c)+I)+1/16*I/d/a^4/(tan(d*x+c)-I)^2*A-7/16/d/a^4/(tan
(d*x+c)-I)^2*B-1/8*I/d/a^4/(tan(d*x+c)-I)^4*A+1/8/d/a^4/(tan(d*x+c)-I)^4*B-1/16/d/a^4/(tan(d*x+c)-I)*A+1/16*I/
d/a^4/(tan(d*x+c)-I)*B+1/32*I/d/a^4*ln(tan(d*x+c)-I)*A+1/32/d/a^4*ln(tan(d*x+c)-I)*B-1/4/d/a^4/(tan(d*x+c)-I)^
3*A-5/12*I/d/a^4/(tan(d*x+c)-I)^3*B

________________________________________________________________________________________

maxima [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: RuntimeError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^2*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^4,x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: Error executing code in Maxima: expt: undefined: 0 to a negative e
xponent.

________________________________________________________________________________________

mupad [B]  time = 6.40, size = 135, normalized size = 0.93 \[ \frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (-\frac {B}{4\,a^4}+\frac {A\,1{}\mathrm {i}}{4\,a^4}\right )-{\mathrm {tan}\left (c+d\,x\right )}^3\,\left (\frac {A}{16\,a^4}-\frac {B\,1{}\mathrm {i}}{16\,a^4}\right )+\frac {B}{12\,a^4}+\mathrm {tan}\left (c+d\,x\right )\,\left (\frac {A}{16\,a^4}+\frac {B\,13{}\mathrm {i}}{48\,a^4}\right )}{d\,\left ({\mathrm {tan}\left (c+d\,x\right )}^4-{\mathrm {tan}\left (c+d\,x\right )}^3\,4{}\mathrm {i}-6\,{\mathrm {tan}\left (c+d\,x\right )}^2+\mathrm {tan}\left (c+d\,x\right )\,4{}\mathrm {i}+1\right )}+\frac {x\,\left (B+A\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{16\,a^4} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((tan(c + d*x)^2*(A + B*tan(c + d*x)))/(a + a*tan(c + d*x)*1i)^4,x)

[Out]

(tan(c + d*x)^2*((A*1i)/(4*a^4) - B/(4*a^4)) - tan(c + d*x)^3*(A/(16*a^4) - (B*1i)/(16*a^4)) + B/(12*a^4) + ta
n(c + d*x)*(A/(16*a^4) + (B*13i)/(48*a^4)))/(d*(tan(c + d*x)*4i - 6*tan(c + d*x)^2 - tan(c + d*x)^3*4i + tan(c
 + d*x)^4 + 1)) + (x*(A*1i + B)*1i)/(16*a^4)

________________________________________________________________________________________

sympy [A]  time = 2.06, size = 243, normalized size = 1.68 \[ \begin {cases} \frac {\left (98304 i A a^{12} d^{3} e^{16 i c} e^{- 4 i d x} + 196608 B a^{12} d^{3} e^{18 i c} e^{- 2 i d x} - 65536 B a^{12} d^{3} e^{14 i c} e^{- 6 i d x} + \left (- 24576 i A a^{12} d^{3} e^{12 i c} + 24576 B a^{12} d^{3} e^{12 i c}\right ) e^{- 8 i d x}\right ) e^{- 20 i c}}{3145728 a^{16} d^{4}} & \text {for}\: 3145728 a^{16} d^{4} e^{20 i c} \neq 0 \\x \left (- \frac {- A + i B}{16 a^{4}} + \frac {\left (- A e^{8 i c} + 2 A e^{4 i c} - A + i B e^{8 i c} - 2 i B e^{6 i c} + 2 i B e^{2 i c} - i B\right ) e^{- 8 i c}}{16 a^{4}}\right ) & \text {otherwise} \end {cases} - \frac {x \left (A - i B\right )}{16 a^{4}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)**2*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))**4,x)

[Out]

Piecewise(((98304*I*A*a**12*d**3*exp(16*I*c)*exp(-4*I*d*x) + 196608*B*a**12*d**3*exp(18*I*c)*exp(-2*I*d*x) - 6
5536*B*a**12*d**3*exp(14*I*c)*exp(-6*I*d*x) + (-24576*I*A*a**12*d**3*exp(12*I*c) + 24576*B*a**12*d**3*exp(12*I
*c))*exp(-8*I*d*x))*exp(-20*I*c)/(3145728*a**16*d**4), Ne(3145728*a**16*d**4*exp(20*I*c), 0)), (x*(-(-A + I*B)
/(16*a**4) + (-A*exp(8*I*c) + 2*A*exp(4*I*c) - A + I*B*exp(8*I*c) - 2*I*B*exp(6*I*c) + 2*I*B*exp(2*I*c) - I*B)
*exp(-8*I*c)/(16*a**4)), True)) - x*(A - I*B)/(16*a**4)

________________________________________________________________________________________